class CreateGroups < ActiveRecord::Migration
  def self.up
    create_table :groups do |t|
      t.string :code
      t.references :evaluation_type
      t.references :subject
      t.references :academic_term
      t.references :group_type
      t.integer :capacity
      t.boolean :allow_overflow, :default => false

      t.timestamps
    end
    add_index(:groups, :code, :unique => true)
  end

  def self.down
    remove_index(:groups, :column => :code)
    drop_table :groups
  end
end
